import request from '@/utils/request'
// 创建用户
export function userCreate(params) {
  return request({
    url: '/user/create',
    method: 'post',
    //   params: { id },
    data: params,
  })
}

// 删除用户
export function userDelete(params) {
  return request({
    url: '/user/delete',
    method: 'delete',
    params,
  })
}

// 启用或者禁用用户
export function userModify(params) {
  return request({
    url: '/user/modify',
    method: 'post',
    data: params,
    //   params: { id },
  })
}

// 启用或者禁用用户-检索一级用户
export function userListPage(params) {
  return request({
    url: '/user/list-page',
    method: 'get',
    // data: params,
    params,
    //   params: { id },
  })
}

// 启用或者禁用用户-检索所有用户
export function userListPageAll(params) {
  return request({
    url: '/admin/user/list',
    method: 'get',
    // data: params,
    params,
    //   params: { id },
  })
}

// 编辑用户
export function userpwdModify(params) {
  return request({
    url: '/user/pwd/modify',
    method: 'post',
    data: params,
    //   params
    //   params: { id },
  })
}

// 启用或者禁用用户
export function userLogin(params) {
  return request({
    url: '/user/login',
    method: 'post',
    data: params,
    //   params
    //   params: { id },
  })
}

// 启用或者禁用用户
export function roleSetUsers(params) {
  return request({
    url: '/role/set-users',
    method: 'post',
    data: params,
    //   params
    //   params: { id },
  })
}

// 创建子用户
export function userCreateSon(params) {
  return request({
    url: '/user/create-son',
    method: 'post',
    data: params,
  })
}

// 
export function deleteSon(params) {
  return request({
    url: '/user/delete-son',
    method: 'delete',
    data: params,
    params
  })
}

// 启用或者禁用用户
export function userListSon(params) {
  return request({
    url: '/user/list-son',
    method: 'get',
    data: params,
      params
    //   params: { id },
  })
}



// 根据token获取用户信息
export function getUserInfoByToken(params) {
  return request({
    url: '/user/getUserInfo',
    method: 'get',
    params
    //   params: { id },
  })
}

//根据子用户id去找到父用户信息
export function getDadInfoByUserId(params){
  return request({
    url: '/genius/platform-goods',
    method: 'get',
    params
    //   params: { id },
  })
}

//获取用户密码
export function getUserPassword(params){
  return request({
    url: '/user/getUserPassword',
    method: 'get',
    params
    //   params: { id },
  })
}

// 获取指定用户所有父级用户的信息
export function viewParents(params){
  return request({
    url: 'user/view-parents',
    method: 'get',
    params
  })
}


